<template>
    <van-nav-bar title="详情" left-text="返回" left-arrow @click-left="() => { $router.back('/') }" />

    <div v-html="xqdata.goods_introduce"></div>
    <van-action-bar>
        <van-action-bar-icon icon="chat-o" text="客服" />
        <van-action-bar-icon icon="shop-o" text="店铺" />
        <van-action-bar-button color="#be99ff" type="warning" text="加入购物车" @click="gwc" />
        <van-action-bar-button color="#7232dd" type="danger" text="立即购买" />
    </van-action-bar>

</template>

<script setup>
import { useRoute, useRouter } from 'vue-router';
let route = new useRoute()
let router = new useRouter()
import { ref } from "vue";
import { detailApi } from '@/api/api'
let xqdata = ref([])
detailApi(route.params.goods_id).then(res => {
    console.log('详情', res);
    xqdata.value = res.data.message
})

import { useCounterStore } from '@/stores/cart'
// 可以在组件中的任意位置访问 `store` 变量 ✨
const store = useCounterStore()
const gwc = () => {
    store.addcart(xqdata.value, route.params.goods_id)
    router.push('/home/cart')
}
</script>

<style lang="scss" scoped></style>